<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script src="./js/jq.js"></script>
	<script src="./js/ajaxfileupload.js"></script>
	<style>
		.test{
			width: 20px;
			height:20px;
			background-color: #fcd;
		}
		.test2{
			background-color: #cfd;
		}
	</style>
</head>
<body>
	<form action="">
		<div class="test"></div>
		<input type="file" name="myVideo" id="myVideo"><br>
		<input type="button" value="save" id="buttonUpload">
	</form>
	<script language="javascript">
	  	jQuery(function(){    
	  	  $('.test').click(function(){
	  	  		$(this).addClass('test2');
	  	  });
	      $("#buttonUpload").click(function(){      
	           //加载图标    
	          /* $("#loading").ajaxStart(function(){
	            $(this).show();
	         }).ajaxComplete(function(){
	            $(this).hide();
	         });*/
	          //上传文件
	          $.ajaxFileUpload({
			        url:'upload.php',//处理图片脚本
			        secureuri :false,
			        fileElementId :'myVideo',//file控件id
			        dataType : 'json',
			        data: {'pageId':1111,'ao': 'xxx'},
			        success : function (data, status){
			        	console.log(data);
			            if(typeof(data.error) != 'undefined'){
			                if(data.error != ''){
			                    alert(data.error);
			                }else{
			                    alert(data.msg);
			                }
			            }
			        },
			        error: function(data, status, e){
			            alert(e);
			        	}
				    })
		   	 return false;
	        })  
	  	})

</script>

</body>
</html>